import type { AxiosRequestConfig, AxiosRequestHeaders } from 'axios'

export interface IAxiosRequestConfig extends AxiosRequestConfig {
  needToken?: boolean
  needLoading?: boolean
  repeatRequest?: boolean
}

export interface IInternalAxiosRequestConfig extends IAxiosRequestConfig {
  headers: AxiosRequestHeaders
  pendKey?: string
}

export enum ContentTypeEnum {
  // json
  JSON = 'application/json;charset=UTF-8',
  // form-data qs
  FORM_URLENCODED = 'application/x-www-form-urlencoded;charset=UTF-8',
  // form-data  upload
  FORM_DATA = 'multipart/form-data;charset=UTF-8'
}

export interface IResult<T> {
  code: number
  data?: T
  msg: string
  path?: any
  extra?: any
  timestamp: string
  errorMsg: string
  isSuccess: number
}

export interface UploadFileParams {
  data?: Recordable
  name?: string
  file: File | Blob
  filename?: string
  [key: string]: any
}
